<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="../dist/vue.js"></script>
    <div id="app">
        <child :cb="handler" @xxx="handler"></child>
    </div>
    <script>
        const vm = new Vue({ // 父组件
            el: '#app',
            methods:{
                handler(data){
                    console.log(data);
                }
            },
            components:{
                child:{
                    props:{
                        cb:{ type:Function}
                    },
                    template:`<div>child  <button @click="$emit('xxx','123')">点击触发</button></div>`
                }
            }
        })
    </script>
</body>

</html>